package com.skillworld.webapp.web.pages.rest.user;

import org.apache.tapestry5.annotations.ContentType;
import org.apache.tapestry5.annotations.Property;
import org.apache.tapestry5.annotations.SessionState;

import com.skillworld.webapp.web.util.UserSession;

@ContentType("text/xml")
public class Logout 
{

    @SuppressWarnings("unused")
    @Property
    private String errorMessage = null;

    @SessionState(create=false)
    private UserSession userSession;

    
    void onPassivate() {
        return;
    }
    
    void onActivate()
    {
        if (userSession == null)
        {
            errorMessage = "not-logged-in";
            return;
        }
        
        userSession = null; // destroy user session
    }   

}
